package com.ligang.controller;

import com.ligang.entity.Video;
import com.ligang.service.VideoService;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;

/**
 * (Video)表控制层
 *
 * @author makejava
 * @since 2021-06-30 14:19:16
 */
@RestController
@RequestMapping("api/v1/video")
public class VideoController {
    /**
     * 服务对象
     */
    @Resource
    private VideoService videoService;

    /**
     * 通过主键查询单条数据
     *
     * @param videoId 主键
     * @return 单条数据
     */
    @GetMapping("find_by_id")
    public Video findById(Integer videoId, HttpServletRequest request ) {
        Video video = videoService.queryById(videoId);
        video.setServerInfo(request.getServerName()+":"+request.getServerPort());
        return video;
    }

}